package com.eastcode.base.util;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

public class HttpUtil {

	/**
	 * 解析request参数
	 * 
	 * @param request
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static Map<String, String> parseRequest(HttpServletRequest request) {
		Enumeration<String> paramNames = request.getParameterNames();
		Map<String, String> resultMap = new HashMap<String, String>();

		while (paramNames.hasMoreElements()) {
			String key = paramNames.nextElement();
			String param = request.getParameter(key);
			resultMap.put(key, param);
		}

		return resultMap;
	}
}
